<?
include_once('config.inc.php');

$file_size=ini_get('upload_max_filesize');
$file_size=str_replace("M","",$file_size);

$post_size = str_replace("M","",ini_get('post_max_size'));
if( $post_size <= $file_size ){
	$file_size = $post_size - 0.1;
}
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!--<script type="text/javascript" src="source/mootools-trunk.js"></script>-->
	<script type="text/javascript" src="js/FancyUpload/mootools.js"></script>
	<script type="text/javascript" src="js/FancyUpload/Fx.ProgressBar.js"></script>
	<script type="text/javascript" src="js/FancyUpload/Swiff.Uploader.js"></script>
	<script type="text/javascript" src="js/FancyUpload/FancyUpload3.Attach.js"></script>
	<script type="text/javascript">
var filzesize='<?=$file_size?>';
window.addEvent('domready', function() {
 
	/**
	 * Uploader instance
	 */
	var up = new FancyUpload3.Attach('demo-list', '#demo-attach, #demo-attach-2', {
		path: 'js/FancyUpload/Swiff.Uploader.swf',
		//url: 'showcase/script.php',
		url: 'uploader.php',
		//url: $('form-demo').action,
		fileSizeMax: filzesize * 1024 *1024,
 
		verbose: true,
 
		onSelectFail: function(files) {
			files.each(function(file) {
				new Element('li', {
					'class': 'file-invalid',
					events: {
						click: function() {
							this.destroy();
						}
					}
				}).adopt(
					new Element('span', {html: file.validationErrorMessage || file.validationError})
				).inject(this.list, 'bottom');
			}, this);	
		},
 
		onFileSuccess: function(file) {
			//new Element('input', {type: 'checkbox',name:'wenjian[]','checked': true}).inject(file.ui.element, 'top');
			file.ui.element.highlight('#e6efc2');
			document.getElementById("shangchuan").disabled=false;
		},
 
		onFileError: function(file) {
			file.ui.cancel.set('html', 'Retry').removeEvents().addEvent('click', function() {
				file.requeue();
				return false;
			});
 
			new Element('span', {
				html: file.errorMessage,
				'class': 'file-error'
			}).inject(file.ui.cancel, 'after');
		},
 
		onFileRequeue: function(file) {
			file.ui.element.getElement('.file-error').destroy();
 
			file.ui.cancel.set('html', 'Cancel').removeEvents().addEvent('click', function() {
				file.remove();
				return false;
			});
 
			this.start();
		}
 
	});
 
});

function jiance()
{
	if(document.getElementById("yh_youxiang").value=="")
	{
		document.getElementById("span_yh_youxiang").innerHTML="<font color='#ff0000'><?=$lang["输入EMAIL提示"]?></font>";
		return false;
	}
	if(document.getElementById("yh_lianxiren").value=="")
	{
		document.getElementById("span_yh_lianxiren").innerHTML="<font color='#ff0000'><?=$lang["输入联系人提示"]?></font>";
		return false;
	}
	return true;
}
function cleartitle(id)
{
	document.getElementById("span_"+id).innerHTML="";
}
</script>
<style>
body,*{line-height:135%}
a.hover {
	color: red;
}
 
#demo-list {
	padding: 0;
	list-style: none;
	margin: 0;
}
 
#demo-list .file-invalid {
	cursor: pointer;
	color: #514721;
	padding-left: 48px;
	line-height: 24px;
	background: url(assets/error.png) no-repeat 24px 5px;
	margin-bottom: 1px;
}
#demo-list .file-invalid span {
	background-color: #fff6bf;
	padding: 1px;
}
 
#demo-list .file {
	line-height: 2em;
	padding-left: 22px;
	background: url(assets/attach.png) no-repeat 1px 50%;
}
 
#demo-list .file span,
#demo-list .file a {
	padding: 0 4px;
}
 
#demo-list .file .file-size {
	color: #666;
}
 
#demo-list .file .file-error {
	color: #8a1f11;
}
 
#demo-list .file .file-progress {
	width: 125px;
	height: 12px;
	vertical-align: middle;
	background-image: url(./assets/progress-bar/progress.gif);
}
.style2 {font-size: 14px;
	font-weight: bold;
	color: #345BA4;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	background-position: center;
	background-color: #d0e2f8;
	margin-right: 0px;
	margin-bottom: 0px;
}
</style> 
<body>


<form action="upload-file.php?lang=<?=$_GET["lang"]?>" method="post" enctype="multipart/form-data" id="form-demo" onSubmit="return jiance();">
	<table border="1" cellpadding="1"  cellspacing="1"  width="475" align="center" bordercolor="#CCCCCC">
		<tr>
			<td width="18%">
			<?=$lang["上傳檔案"]?>：
			</td>
			<td width="82%">
				<a href="#" id="demo-attach"><img src="./assets/btn_upload.gif" width="149" height="30" border="0" align="absmiddle"></a>
				<?=$lang["上传说明"]?><br/>
				<i>(<?=$lang["档案最大说明"]?>:<?=$file_size?>M)</i>
				<ul id="demo-list"></ul>
				<a href="#" id="demo-attach-2" style="display: none;"><img src="./assets/btn_upload.gif" width="149" height="30" border="0" align="absmiddle"></a> </td>
		</tr>
<?
if(is_array($string)&&count($string)>0)
{
	foreach ($string as $key=>$row)
	{
?>
		<tr >
			<td><?=$row?>：</td>
			<td><?
			if($key=='yh_shuoming')
			{
?>
				<input type="text" size="30" maxlength="200" name="data[<?=$key?>]" id="<?=$key?>">
<?
			}
			else 
			{
?>
				<input type="text" onKeyUp="cleartitle(this.id);" name="data[<?=$key?>]" id="<?=$key?>">
<?
			if($key=="yh_youxiang" || $key=="yh_lianxiren")
			{
				echo "<font color='#ff0000'>*</font>";
			}
?>
				<span id="span_<?=$key?>"></span>
<?
			}
?>
			</td>
		</tr>
<?
	}
}
?>
		<tr>
			<td colspan="2" align="center" ><input type="submit" disabled=true id="shangchuan"  value="<?=$lang["確定上傳完成"]?>" >
				<input type="hidden" value="1" name="op">
			</td>
		</tr>
	</table>
</form>

</body>
</html>